package cn.itcast.service.impl;

import cn.itcast.dao.AddressDao;
import cn.itcast.pojo.Address;
import cn.itcast.service.AddressService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;

import java.util.List;

@Service
public class AddressServiceImpl implements AddressService {

    @Autowired
    private AddressDao addressDao;

    @Override
    public List<Address> findAll() {
        List<Address> list = addressDao.findAll();
        if (CollectionUtils.isEmpty(list)){
            return null;
        }
        return list;
    }

    @Override
    public Address findById(Integer id) {
        return addressDao.findById(id);
    }



    @Override
    public void add(Address address) {
        addressDao.add(address);

    }

    @Override
    public void update(Address address) {
        addressDao.update(address);

    }

    @Override
    public void delete(Integer id) {
        addressDao.delete(id);
    }

    @Override
    public void change(Address address) {
        addressDao.change(address);
    }

}
